<?php
error_reporting(E_ALL);
//根目录定义
define("ROOTDIR",$_SERVER['DOCUMENT_ROOT']."/");
if($_SERVER["SERVER_NAME"]=='qiyue.zhongsou.com' || $_SERVER["SERVER_NAME"]=='qiyuenew.zhongsou.com'){
    ini_set('session.save_handler', 'redis');
    ini_set('session.save_path', 'tcp://103.7.222.41:6399');
}
session_start();
//加载基类与函数库
include ROOTDIR."include/lxbase.class.php";
include ROOTDIR."public/func.php";
//控制器目录
define("CPATH",ROOTDIR."app/hotel/app/");
define("CPOSTFIX",".class");
//获得URL
$app_path= str_replace($_SERVER['DOCUMENT_ROOT'], '', __FILE__);    
$app_request=trim(str_replace($app_path, '', $_SERVER['REQUEST_URI']),"/");
//解析URL
$urlinfo = Lxbase::urlreload($app_request);
$model = empty($urlinfo["model"])?"Index_con":ucfirst(strtolower($urlinfo["model"]))."_con";
$func = empty($urlinfo["function"])?"index":$urlinfo["function"];
$murl=empty($urlinfo["model"])?"index":strtolower($urlinfo["model"]);
$exemp = Lxbase::getconfig('exemp');
/*
if(!isset($exemp[$murl][$func]) && empty($_SESSION["userinfo"])){
	Lxbase::gologin();
}
*/
include (CPATH.$murl.CPOSTFIX.".php");
if(!class_exists($model)) die('没有找到类'.$model);
$obj = new $model();
if(method_exists($obj,'setinit')){
	$obj->setinit("app/hotel/");
}
if(!empty($_SESSION["userinfo"]["userid"]) && empty($_SESSION["hyid"])){
	$_SESSION["hyid"] = $obj->oncedata("id","hotel","where uid=".$_SESSION["userinfo"]["userid"]."");
}elseif(empty($_SESSION["userinfo"]["userid"])){
	$_SESSION["hyid"]=0;
    header('location:'.$obj->basehost);exit;
}
$obj->$func();